<?php
use yii\helpers\Url;
use yii\helpers\Html;

return [
    [
        'class' => 'kartik\grid\CheckboxColumn',
        'width' => '20px',
    ],
    [
        'class' => 'kartik\grid\SerialColumn',
        'width' => '30px',
    ],
        [
        'class'=>'\kartik\grid\DataColumn',
        'attribute'=>'tk_id',
    ],
    [
        'class'=>'\kartik\grid\DataColumn',
        'attribute'=>'tk_uid',
    ],
    [
        'label'=>'客户',
        'attribute' => 'u_name',
        'value' => 'member.u_name' ],
    [
        'class'=>'\kartik\grid\DataColumn',
        'attribute'=>'tk_token',
    ],
    [
        'class'=>'\kartik\grid\DataColumn',
        'attribute'=>'tk_expiration',
    ],
    [
        'class' => 'kartik\grid\ActionColumn',
        'dropdown' => false,
        'vAlign'=>'middle',
        'urlCreator' => function($action, $model, $key, $index) { 
                return Url::to([$action,'id'=>$key]);
        },
        'viewOptions'=>['role'=>'modal-remote','title'=>'View','data-toggle'=>'tooltip'],
        'updateOptions'=>['role'=>'modal-remote','title'=>'Update', 'data-toggle'=>'tooltip'],
        'deleteOptions'=>['role'=>'modal-remote','title'=>'Delete', 
                          'data-confirm'=>false, 'data-method'=>false,// for overide yii data api
                          'data-request-method'=>'post',
                          'data-toggle'=>'tooltip',
                          'data-confirm-title'=>'Are you sure?',
                          'data-confirm-message'=>'Are you sure want to delete this item'], 
    ],
    [
        'label' => '更多操作',
        'format' => 'raw',
        'mergeHeader' => true,
        'value' => function ($model) {
//            return $model->tk_uid.Html::a();
            return  Html::a(\kartik\icons\Icon::show('minus-square'), ['api-token/force-login', 'id' => $model->tk_id], [
                    'title' => '强制重新登录',
                    'role' => 'modal-remote',
                    'data-toggle' => 'tooltip',
                    'data-confirm-title'=>'Are you sure?',
                    'data-confirm-message'=>'确认让此用户重新登录app'
                ]);
        },
        'contentOptions' => ['style' => 'vertical-align: middle;'],
    ],

];   